package com.yequan.spring.bean.definition;

import com.yequan.spring.ioc.overview.domain.User;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author : Administrator
 * @date : 2020/4/1
 */
public class BeanAliasDemo {

    public static void main(String[] args) {

        BeanFactory beanFactory = new ClassPathXmlApplicationContext("classpath:/META-INF/bean-definitions-context.xml");

        //通过别名查找
        User yequanUser = beanFactory.getBean("yequan-user", User.class);

        User user = beanFactory.getBean("user", User.class);

        System.out.println("别名查找和名称查找是否一样: " + (yequanUser == user));


    }

}
